package com.lenovo.nova.widget.baseview;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.util.AttributeSet;
import android.widget.TextView;

public class CustomTextView extends TextView{
    private int[] mState = null;
    private boolean mMergeState = false;
	public CustomTextView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		initLayout(context,null);
	}

	public CustomTextView(Context context, AttributeSet attrs) {
		super(context, attrs);
		initLayout(context,attrs);
	}


	public CustomTextView(Context context) {
		super(context);
		initLayout(context, null);
	}

    private void initLayout(Context context, Object o) {

    }

    @Override
    public int[] onCreateDrawableState(int extraSpace) {
        if (mState == null) {
            return super.onCreateDrawableState(extraSpace);
        } else if (!mMergeState) {
            return mState;
        } else {
            return mergeDrawableStates(
                    super.onCreateDrawableState(extraSpace + mState.length), mState);
        }
    }

    public void setImageState(int[] state) {
        mState = state;
        mMergeState = true;
//        if (mDrawable != null) {
//            refreshDrawableState();
//            resizeFromDrawable();
//        }
    }


    @Override
    protected void drawableStateChanged() {
        super.drawableStateChanged();
    }
}
